package com.lxxie.common.thread;

import java.util.concurrent.*;

/**
 * Created by xielx on 21/1/22 14:44
 */
public class ThreadPool {
        private final static ConcurrentHashMap<String, ThreadPoolExecutor> THREAD_POOL_HOLDER = new ConcurrentHashMap<>();

        private ThreadPool() {
        }

        public static ThreadPoolExecutor createThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveTime,
                                                          TimeUnit unit, BlockingQueue<Runnable> workQueue,
                                                          ThreadFactory threadFactory, RejectedExecutionHandler handler) {
                ThreadPoolExecutor pool = new ThreadPoolExecutor(corePoolSize,maximumPoolSize,keepAliveTime,unit,workQueue,threadFactory,handler);
                return pool;
        }
}
